package com.learn;

import java.util.Arrays;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class AspectLog {

	@Before("execution(* com.learn.dao..*.*(..))")//com.learn.dao包，子包，子子包下的所有的类的所有的方法
	public void log(){
		System.out.println("before method doing ...");
	}
	
	@After("execution(* com.learn.dao..*.*(..))")//com.learn.dao包，子包，子子包下的所有的类的所有的方法
	public void logAfter(JoinPoint point){
		System.out.println("after method doing ..."+point.getTarget().getClass()+",args :"+Arrays.asList(point.getArgs())+",method:"+point.getSignature().getName());
	}
}
